package cn.com.dev;

import cn.com.kh.JsonFormatUtil;
import cn.com.kh.KHUtil;
import cn.com.kh.kafkaUtil;
import net.sf.json.JSONObject;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Title: cn.com.dev-sendMsg
 * @Description:ngsapitask-pa 系统API接口开发Demo，重点关注业务逻辑部分
 * @Author: lijun
 * @Date 2021-12-18 20:58
 */
public class sendMsg {
    public static void main(String[] args) throws InterruptedException {

        int total = 2;
        int i = 0;
        while (i < total) {
            i++;
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmm");
            Date date = new Date(System.currentTimeMillis());
            String nowTime = formatter.format(date);

            String Topic = "sync_external_user_status";
            // 图片消息
            String CallJson = "{\"gender\":\"1\",\"mobile\":\"15116679676\",\"avatar\":\"http://wx.qlogo.cn/mmhead/PiajxSqBRaEJ9nmDPUuqWkzEhPvXkzicLGl88JlhKUS8HsGZbr1wxSLA/0\",\"type\":\"1\",\"followUserId\":\"zhawenli\",\"createTime\":\"1626932224\",\"externalUserId\":\"wmhFfECAAATc4UxF1WAxp9u61pov4FaA\",\"name\":\"哈哈哈\"}";

            JSONObject callResult = kafkaUtil.sendMsg("aloracle:8020", Topic, CallJson);
            System.out.println("序号MsgId:" + i + "时间序号:" + nowTime + " 推送结果:" + callResult.toString());

            Thread.sleep(3000);
        }

        kafkaUtil.getMsg("aloracle:8020", "qweqwe", "sync_external_user_status".split(","), 1, "http://wx.qlogo.cn");
    }
}
